package com.eleventwelve.iris.entity;

import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.OneToMany;
import javax.persistence.Transient;

import org.opentides.bean.Auditable;
import org.opentides.bean.FileInfo;
import org.opentides.bean.user.BaseUser;
import org.springframework.web.multipart.MultipartFile;

/**
 * 
 * @author Ashley
 *
 */
@Entity
@DiscriminatorValue("IrisUser")
public class IrisUser extends BaseUser implements Auditable, PhotoUploadable {
	private static final long serialVersionUID = 1302275596911888018L;
	
	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
	@JoinTable(name = "USER_FILES", joinColumns = { @JoinColumn(name = "USER_ID", referencedColumnName = "ID") }, inverseJoinColumns = @JoinColumn(name = "FILE_INFO_ID"))
	private List<FileInfo> files;
	
	@Transient
	private Staff linkedStaff;
	
	@Transient
	private MultipartFile photo;
	
	@Column(name="TEST")
	private String test;

	public Staff getLinkedStaff() {
		return linkedStaff;
	}

	public void setLinkedStaff(Staff linkedStaff) {
		this.linkedStaff = linkedStaff;
	}

	public String getTest() {
		return test;
	}

	public void setTest(String test) {
		this.test = test;
	}

	public MultipartFile getPhoto() {
		return photo;
	}

	public void setPhoto(MultipartFile photo) {
		this.photo = photo;
	}

	@Override
	public List<FileInfo> getFiles() {
		return files;
	}

	@Override
	public void setFiles(List<FileInfo> files) {
		this.files = files;
	}

}
